//
//  AppDelegate.swift
//  iOS
//
//  Created by gongkai on 15/4/17.
//  Copyright (c) 2015年 gongkai. All rights reserved.
//

import UIKit


class BaseAppDelegate: UIResponder, UIApplicationDelegate {
    
    var window: UIWindow?
    
    override init() {
        super.init()
    }
    
    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        self.initService()
        return true
    }
    
    
    //初始化服务
    func initService(){
        //umeng
        if(key_umeng != ""){
            MobClick.startWithAppkey(key_umeng, reportPolicy: BATCH, channelId: nil)
            MobClick.setAppVersion(version)
            MobClick.setBackgroundTaskEnabled(false)
            
            //umeng集成测试获取id
            if(false){
                let cls: AnyClass! = NSClassFromString("UMANUtil")
                let sel = Selector("openUDIDString")
                var deviceID:String!
                if(cls != nil && cls.respondsToSelector(sel)){
                    deviceID = NSObject.swift_performSelector(sel, withClass: cls) as? String
                }
                println("{\"oid\": \"\(deviceID)\"}")
            }
        }
    }
    
}

